// import { registerMicroApps, start } from 'qiankun';
// const getActiveRule = (hash) => (location) => location.hash.startsWith(hash)
// registerMicroApps(
//     Object.keys(apps).map(key => ({
//         ...apps[key],
//         entry: apps[key].url,
//         // activeRule: '#' + apps[key].baseroute,
//         activeRule: getActiveRule('#' + apps[key].baseroute),
//     }))
// );
// // 启动 qiankun
// start();
const apps = {
    product: {
        url: 'http://localhost:1001/',
        name: 'product',
        container: '.yzh-body',
        baseroute: '/product'
    },
    order: {
        url: 'http://localhost:1003/',
        name: 'order',
        container: '.yzh-body',
        baseroute: '/order'
    },
    operation: {
        url: 'http://localhost:8080/',
        name: 'operation',
        container: '.yzh-body',
        baseroute: '/operation'
    },
    supplier: {
        url: 'http://localhost:1005/',
        name: 'supplier',
        container: '.yzh-body',
        baseroute: '/supplier'
    },
    finance: {
        url: 'http://localhost:1006/',
        name: 'finance',
        container: '.yzh-body',
        baseroute: '/finance'
    },
    enterprise: {
        url: 'http://ec-show.haoxiny.com/',
        name: 'enterprise',
        container: '.yzh-body',
        baseroute: '/enterprise'
    }
}
switch (process.env.REACT_APP_ENV) {
    case 'development':
        apps.product.url = 'http://product.test.limofang.cn/'
        apps.order.url = 'http://order.test.limofang.cn/'
        apps.operation.url = 'http://operate.test.limofang.cn/'
        apps.supplier.url = 'http://supplier.test.limofang.cn/'
        apps.finance.url = 'http://finance.test.limofang.cn/'

        // apps.product.url = 'http://localhost:1001/'
        // apps.order.url = 'http://localhost:1003/'
        apps.operation.url = 'http://localhost:8080/'
        // apps.supplier.url = 'http://localhost:1005/'
        apps.enterprise.url = 'http://enterprise.test.limofang.cn/'
        break
    case 'test':
        apps.product.url = 'http://product.test.limofang.cn/'
        apps.order.url = 'http://order.test.limofang.cn/'
        apps.operation.url = 'http://operate.test.limofang.cn/'
        apps.supplier.url = 'http://supplier.test.limofang.cn/'
        apps.finance.url = 'http://finance.test.limofang.cn/'
        break
    case 'test219':
        apps.product.url = 'http://product.219.limofang.cn/'
        apps.order.url = 'http://order.219.limofang.cn/'
        apps.operation.url = 'http://operate.219.limofang.cn/'
        apps.supplier.url = 'http://supplier.219.limofang.cn/'
        apps.finance.url = 'http://finance.219.limofang.cn/'
        break
    case 'show':
        apps.product.url = 'https://product.show.yunzhonghe.com/'
        apps.order.url = 'https://order.show.yunzhonghe.com/'
        apps.operation.url = 'https://operate.show.yunzhonghe.com/'
        apps.supplier.url = 'https://supplier.show.yunzhonghe.com/'
        apps.finance.url = 'https://finance.show.yunzhonghe.com/'
        break
    default:
        apps.product.url = 'https://product.yunzhonghe.com/'
        apps.order.url = 'https://order.yunzhonghe.com/'
        apps.operation.url = 'https://operate.yunzhonghe.com/'
        apps.supplier.url = 'https://supplier.yunzhonghe.com/'
        apps.finance.url = 'https://finance.yunzhonghe.com/'
        break
}
const config = {
    inline: process.env.NODE_ENV !== 'production', // 是否使用内联script 默认值false
    destory: true, // 卸载时是否强制删除缓存资源 默认值false
    disableScopecss: false, // 禁用样式隔离 默认值false
    disableSandbox: false, // 禁用js沙箱 默认值false
    macro: true, // 以宏任务方式绑定元素作用域 默认值false
    shadowDOM: false, // 是否开启shadowDOM 默认值false
    preFetchApps: [
        // apps.product
        // ...Object.keys(apps).map(key => apps[key])
    ],
    // lifeCycles: {
    //     created (e) {
    //         console.log('created')
    //     },
    //     beforemount (e) {
    //         console.log('beforemount')
    //     },
    //     mounted (e) {
    //         console.log('mounted')
    //     },
    //     unmount (e) {
    //         console.log('unmount')
    //     },
    //     error (e) {
    //         console.log('error')
    //     }
    // }
}

export {
    config,
    apps
}